1 Rmd Settings

Sys.setenv(LANG = "en") #English
knitr::opts_chunk$set(echo = TRUE)
rm(list = ls())

path <- getwd()

setwd(path)

# packages
pacman::p_load(tidyverse, plotly,readxl,scales, extrafont,PerformanceAnalytics, GGally, patchwork, ggpubr, DT, estimatr, texreg, modelsummary)

# Font for windows and mac
if (stringr::str_detect(path, pattern="Users")){ 
  
   theme_set(theme_classic(base_size = 10, base_family = "HiraginoSans-W3"))  # For Mac OS

 } else{
  
theme_set(theme_classic(base_size = 10, base_family = "Arial"))        # For Windows
 }

2 Contents

  • WLS regression of suicide on unemployment-rate shock (unemploy_diff2)

  • dynamic_DID_OLS_notrend: dynamic DID with OLS and without prefectre linear trend

  • dynamic_DID_WLS_notrend: dynamic DID with WLS and without prefectre linear trend

  • dynamic_DID_OLS_trend: dynamic DID with OLS and prefectre linear trend

  • dynamic_DID_WLS_trend: dynamic DID with WLS and prefectre linear trend

  • dynamic_onlypost_DID_WLS_trend: dynamic DID only and with WLS and prefectre linear trend, reference periods = all the pre-COVID months

  • _covar8Xcovid_months: with eight covariates interacted with month dummies

3 Read functions/関数の読み込み

source("functions.R")

4 Read data/分析用データの読み込み

df_analysis <- readr::read_csv("output/df_analysis.csv")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   prefec_kanji = col_character(),
##   prefecture = col_character(),
##   date = col_date(format = ""),
##   prefec = col_character(),
##   prefec_kanji2 = col_character()
## )
## See spec(...) for full column specifications.

5 Main figures in the paper

  • We firstly provide estimations and figures used in the main text.
  • These chunks are copied and pasted from subsequent outcome-based result sections.
  • Actual graphs and tables in the paper are generated and saved in the subsequent chunks, not the chunks in this section. But they are identical.

6 Y=total sucide rate/男女合計の自殺率

6.5 WLS, with trends, post-covid-month dummies, Table C.1 (2)

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend(dataset = df_analysis, 
                    outcome_var = df_analysis$suicide_rate, 
                    treat_var = df_analysis$unemploy_shock_diff2)

texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3)
## 1 coefficient  not defined because the design matrix is rank deficient
## 
## ===========================================
##                                Model 1     
## -------------------------------------------
## treat_var:date_2020_02           -0.007    
##                                  (0.074)   
## treat_var:date_2020_03           -0.051    
##                                  (0.086)   
## treat_var:date_2020_04            0.016    
##                                  (0.078)   
## treat_var:date_2020_05            0.158    
##                                  (0.104)   
## treat_var:date_2020_06            0.245 ** 
##                                  (0.074)   
## treat_var:date_2020_07            0.308 ***
##                                  (0.063)   
## treat_var:date_2020_08            0.056    
##                                  (0.119)   
## treat_var:date_2020_09           -0.003    
##                                  (0.091)   
## as.factor(id)1:year_month_id     -0.011 ***
##                                  (0.003)   
## as.factor(id)2:year_month_id     -0.015 ***
##                                  (0.001)   
## as.factor(id)3:year_month_id     -0.009 ***
##                                  (0.002)   
## as.factor(id)4:year_month_id     -0.009 ***
##                                  (0.002)   
## as.factor(id)5:year_month_id     -0.009 ***
##                                  (0.002)   
## as.factor(id)6:year_month_id     -0.013 ***
##                                  (0.002)   
## as.factor(id)7:year_month_id     -0.013 ***
##                                  (0.002)   
## as.factor(id)8:year_month_id     -0.016 ***
##                                  (0.001)   
## as.factor(id)9:year_month_id     -0.012 ***
##                                  (0.001)   
## as.factor(id)10:year_month_id    -0.007 ***
##                                  (0.001)   
## as.factor(id)11:year_month_id    -0.015 ***
##                                  (0.002)   
## as.factor(id)12:year_month_id    -0.014 ***
##                                  (0.002)   
## as.factor(id)13:year_month_id    -0.020 ***
##                                  (0.002)   
## as.factor(id)14:year_month_id    -0.013 ***
##                                  (0.003)   
## as.factor(id)15:year_month_id    -0.016 ***
##                                  (0.001)   
## as.factor(id)16:year_month_id    -0.002    
##                                  (0.002)   
## as.factor(id)17:year_month_id    -0.004 ** 
##                                  (0.001)   
## as.factor(id)18:year_month_id    -0.004 ***
##                                  (0.001)   
## as.factor(id)19:year_month_id    -0.013 ***
##                                  (0.001)   
## as.factor(id)20:year_month_id    -0.011 ***
##                                  (0.001)   
## as.factor(id)21:year_month_id    -0.010 ***
##                                  (0.001)   
## as.factor(id)22:year_month_id    -0.010 ***
##                                  (0.001)   
## as.factor(id)23:year_month_id    -0.010 ***
##                                  (0.001)   
## as.factor(id)24:year_month_id    -0.013 ***
##                                  (0.001)   
## as.factor(id)25:year_month_id    -0.011 ***
##                                  (0.001)   
## as.factor(id)26:year_month_id    -0.011 ***
##                                  (0.002)   
## as.factor(id)27:year_month_id    -0.006    
##                                  (0.003)   
## as.factor(id)28:year_month_id    -0.017 ***
##                                  (0.002)   
## as.factor(id)29:year_month_id    -0.016 ***
##                                  (0.003)   
## as.factor(id)30:year_month_id    -0.021 ***
##                                  (0.003)   
## as.factor(id)31:year_month_id    -0.016 ***
##                                  (0.002)   
## as.factor(id)32:year_month_id              
##                                            
## as.factor(id)33:year_month_id    -0.013 ***
##                                  (0.001)   
## as.factor(id)34:year_month_id    -0.013 ***
##                                  (0.001)   
## as.factor(id)35:year_month_id    -0.010 ***
##                                  (0.001)   
## as.factor(id)36:year_month_id    -0.010 ***
##                                  (0.002)   
## as.factor(id)37:year_month_id    -0.015 ***
##                                  (0.002)   
## as.factor(id)38:year_month_id    -0.014 ***
##                                  (0.001)   
## as.factor(id)39:year_month_id    -0.009 ***
##                                  (0.001)   
## as.factor(id)40:year_month_id    -0.012 ***
##                                  (0.002)   
## as.factor(id)41:year_month_id    -0.029 ***
##                                  (0.000)   
## as.factor(id)42:year_month_id     0.001    
##                                  (0.001)   
## as.factor(id)43:year_month_id    -0.004 ** 
##                                  (0.001)   
## as.factor(id)44:year_month_id    -0.019 ***
##                                  (0.002)   
## as.factor(id)45:year_month_id    -0.008 ***
##                                  (0.001)   
## as.factor(id)46:year_month_id    -0.007 ***
##                                  (0.002)   
## as.factor(id)47:year_month_id    -0.011 ** 
##                                  (0.003)   
## -------------------------------------------
## R^2                               0.432    
## Adj. R^2                          0.379    
## Num. obs.                      1551        
## RMSE                             12.347    
## N Clusters                       47        
## ===========================================
## *** p < 0.001; ** p < 0.01; * p < 0.05
# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "unemploy_shock_diff2",
                                 estimation_label = "total_WLS_trend")

# Event study graph
graph_total_WLS_trend_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "total_WLS_trend")

ggplotly(graph_total_WLS_trend_onlypost)
estimates_total_WLS_trend_onlypost <- df_estimates #for robustness check

results_total_WLS_trend_onlypost <- estimation_results # for only-post DID table

7 Y=total suicide rate/男女合計の自殺率 with covar

7.5 WLS, with trends, post-covid-month dummies, Table C.2 (2)

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend_covar8Xcovid_months(dataset = df_analysis, 
                    outcome_var = df_analysis$suicide_rate, 
                    treat_var = df_analysis$unemploy_shock_diff2)

texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3)
## 1 coefficient  not defined because the design matrix is rank deficient
## 
## ====================================================================
##                                                         Model 1     
## --------------------------------------------------------------------
## treat_var:date_2020_02                                    -0.294 *  
##                                                           (0.138)   
## treat_var:date_2020_03                                    -0.113    
##                                                           (0.162)   
## treat_var:date_2020_04                                    -0.016    
##                                                           (0.106)   
## treat_var:date_2020_05                                     0.078    
##                                                           (0.165)   
## treat_var:date_2020_06                                     0.080    
##                                                           (0.140)   
## treat_var:date_2020_07                                     0.400 ** 
##                                                           (0.148)   
## treat_var:date_2020_08                                    -0.270    
##                                                           (0.165)   
## treat_var:date_2020_09                                    -0.058    
##                                                           (0.168)   
## date_2020_02:google_mobility_index_2020may                 0.006    
##                                                           (0.021)   
## date_2020_03:google_mobility_index_2020may                 0.010    
##                                                           (0.031)   
## date_2020_04:google_mobility_index_2020may                 0.013    
##                                                           (0.026)   
## date_2020_05:google_mobility_index_2020may                -0.034    
##                                                           (0.028)   
## date_2020_06:google_mobility_index_2020may                 0.032 *  
##                                                           (0.015)   
## date_2020_07:google_mobility_index_2020may                -0.007    
##                                                           (0.024)   
## date_2020_08:google_mobility_index_2020may                 0.061    
##                                                           (0.039)   
## date_2020_09:google_mobility_index_2020may                 0.014    
##                                                           (0.033)   
## date_2020_02:infection_rate_cumulative2020jun             -0.019    
##                                                           (0.014)   
## date_2020_03:infection_rate_cumulative2020jun             -0.004    
##                                                           (0.020)   
## date_2020_04:infection_rate_cumulative2020jun             -0.021    
##                                                           (0.013)   
## date_2020_05:infection_rate_cumulative2020jun             -0.025    
##                                                           (0.019)   
## date_2020_06:infection_rate_cumulative2020jun              0.013    
##                                                           (0.012)   
## date_2020_07:infection_rate_cumulative2020jun              0.005    
##                                                           (0.016)   
## date_2020_08:infection_rate_cumulative2020jun              0.007    
##                                                           (0.023)   
## date_2020_09:infection_rate_cumulative2020jun              0.016    
##                                                           (0.017)   
## date_2020_02:death_rate_cumulative2020jun                  0.122    
##                                                           (0.152)   
## date_2020_03:death_rate_cumulative2020jun                  0.024    
##                                                           (0.228)   
## date_2020_04:death_rate_cumulative2020jun                  0.285    
##                                                           (0.175)   
## date_2020_05:death_rate_cumulative2020jun                  0.138    
##                                                           (0.224)   
## date_2020_06:death_rate_cumulative2020jun                  0.050    
##                                                           (0.129)   
## date_2020_07:death_rate_cumulative2020jun                 -0.136    
##                                                           (0.165)   
## date_2020_08:death_rate_cumulative2020jun                 -0.025    
##                                                           (0.279)   
## date_2020_09:death_rate_cumulative2020jun                 -0.184    
##                                                           (0.170)   
## date_2020_02:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_03:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_04:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_05:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_06:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_07:Population_per_1_km_2_of_inhabitable_area    -0.000    
##                                                           (0.000)   
## date_2020_08:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_09:Population_per_1_km_2_of_inhabitable_area    -0.000    
##                                                           (0.000)   
## date_2020_02:Secondary_industry_ratio                     -1.363    
##                                                           (1.984)   
## date_2020_03:Secondary_industry_ratio                      0.082    
##                                                           (2.467)   
## date_2020_04:Secondary_industry_ratio                      0.590    
##                                                           (1.809)   
## date_2020_05:Secondary_industry_ratio                      0.274    
##                                                           (2.068)   
## date_2020_06:Secondary_industry_ratio                      3.038    
##                                                           (1.525)   
## date_2020_07:Secondary_industry_ratio                     -3.794 *  
##                                                           (1.831)   
## date_2020_08:Secondary_industry_ratio                      1.878    
##                                                           (1.890)   
## date_2020_09:Secondary_industry_ratio                      0.236    
##                                                           (1.551)   
## date_2020_02:Tertiary_industry_ratio                       0.606    
##                                                           (2.437)   
## date_2020_03:Tertiary_industry_ratio                       0.734    
##                                                           (3.085)   
## date_2020_04:Tertiary_industry_ratio                       2.087    
##                                                           (2.102)   
## date_2020_05:Tertiary_industry_ratio                      -0.860    
##                                                           (2.975)   
## date_2020_06:Tertiary_industry_ratio                       3.977 *  
##                                                           (1.726)   
## date_2020_07:Tertiary_industry_ratio                      -5.813 *  
##                                                           (2.533)   
## date_2020_08:Tertiary_industry_ratio                       4.725    
##                                                           (2.887)   
## date_2020_09:Tertiary_industry_ratio                       0.506    
##                                                           (2.207)   
## date_2020_02:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_03:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_04:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_05:Total_population                              0.001 *  
##                                                           (0.000)   
## date_2020_06:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_07:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_08:Total_population                             -0.000    
##                                                           (0.000)   
## date_2020_09:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_02:Ratio_of_aged_population                     -0.007    
##                                                           (0.015)   
## date_2020_03:Ratio_of_aged_population                      0.000    
##                                                           (0.017)   
## date_2020_04:Ratio_of_aged_population                      0.001    
##                                                           (0.012)   
## date_2020_05:Ratio_of_aged_population                      0.036 ** 
##                                                           (0.013)   
## date_2020_06:Ratio_of_aged_population                     -0.000    
##                                                           (0.008)   
## date_2020_07:Ratio_of_aged_population                      0.009    
##                                                           (0.012)   
## date_2020_08:Ratio_of_aged_population                     -0.020    
##                                                           (0.017)   
## date_2020_09:Ratio_of_aged_population                      0.008    
##                                                           (0.017)   
## as.factor(id)1:year_month_id                               0.006    
##                                                           (0.003)   
## as.factor(id)2:year_month_id                              -0.001    
##                                                           (0.001)   
## as.factor(id)3:year_month_id                               0.006 ***
##                                                           (0.001)   
## as.factor(id)4:year_month_id                               0.009 ***
##                                                           (0.002)   
## as.factor(id)5:year_month_id                               0.005    
##                                                           (0.003)   
## as.factor(id)6:year_month_id                               0.004    
##                                                           (0.004)   
## as.factor(id)7:year_month_id                               0.005    
##                                                           (0.003)   
## as.factor(id)8:year_month_id                               0.001    
##                                                           (0.002)   
## as.factor(id)9:year_month_id                               0.006 *  
##                                                           (0.003)   
## as.factor(id)10:year_month_id                              0.009 ** 
##                                                           (0.003)   
## as.factor(id)11:year_month_id                              0.001    
##                                                           (0.003)   
## as.factor(id)12:year_month_id                              0.003    
##                                                           (0.004)   
## as.factor(id)13:year_month_id                             -0.006 *  
##                                                           (0.003)   
## as.factor(id)14:year_month_id                              0.003    
##                                                           (0.003)   
## as.factor(id)15:year_month_id                             -0.001    
##                                                           (0.003)   
## as.factor(id)16:year_month_id                              0.015 ***
##                                                           (0.004)   
## as.factor(id)17:year_month_id                              0.015 ***
##                                                           (0.003)   
## as.factor(id)18:year_month_id                              0.011 ***
##                                                           (0.003)   
## as.factor(id)19:year_month_id                              0.006    
##                                                           (0.004)   
## as.factor(id)20:year_month_id                              0.006    
##                                                           (0.004)   
## as.factor(id)21:year_month_id                              0.007    
##                                                           (0.003)   
## as.factor(id)22:year_month_id                              0.007    
##                                                           (0.004)   
## as.factor(id)23:year_month_id                              0.005    
##                                                           (0.003)   
## as.factor(id)24:year_month_id                              0.004    
##                                                           (0.003)   
## as.factor(id)25:year_month_id                              0.009 ** 
##                                                           (0.003)   
## as.factor(id)26:year_month_id                              0.009 *  
##                                                           (0.003)   
## as.factor(id)27:year_month_id                              0.009 ***
##                                                           (0.003)   
## as.factor(id)28:year_month_id                             -0.001    
##                                                           (0.003)   
## as.factor(id)29:year_month_id                              0.002    
##                                                           (0.003)   
## as.factor(id)30:year_month_id                             -0.002    
##                                                           (0.003)   
## as.factor(id)31:year_month_id                                       
##                                                                     
## as.factor(id)32:year_month_id                              0.012 ** 
##                                                           (0.004)   
## as.factor(id)33:year_month_id                              0.003    
##                                                           (0.002)   
## as.factor(id)34:year_month_id                              0.003    
##                                                           (0.003)   
## as.factor(id)35:year_month_id                              0.004    
##                                                           (0.004)   
## as.factor(id)36:year_month_id                              0.007 ** 
##                                                           (0.002)   
## as.factor(id)37:year_month_id                              0.003    
##                                                           (0.003)   
## as.factor(id)38:year_month_id                              0.001    
##                                                           (0.002)   
## as.factor(id)39:year_month_id                              0.006 *  
##                                                           (0.002)   
## as.factor(id)40:year_month_id                              0.004    
##                                                           (0.003)   
## as.factor(id)41:year_month_id                             -0.014 ***
##                                                           (0.002)   
## as.factor(id)42:year_month_id                              0.015 ***
##                                                           (0.002)   
## as.factor(id)43:year_month_id                              0.011 ***
##                                                           (0.001)   
## as.factor(id)44:year_month_id                             -0.003    
##                                                           (0.002)   
## as.factor(id)45:year_month_id                              0.006 ***
##                                                           (0.001)   
## as.factor(id)46:year_month_id                              0.008 ***
##                                                           (0.001)   
## as.factor(id)47:year_month_id                              0.014 *  
##                                                           (0.006)   
## --------------------------------------------------------------------
## R^2                                                        0.457    
## Adj. R^2                                                   0.378    
## Num. obs.                                               1551        
## RMSE                                                      12.357    
## N Clusters                                                47        
## ====================================================================
## *** p < 0.001; ** p < 0.01; * p < 0.05
# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "unemploy_shock_diff2",
                                 estimation_label = "total_WLS_trend")
# Event study graph
graph_total_WLS_trend_covar_onlypost <- event_study_graph(data = df_estimates,
                                          graph_title = "total_WLS_trend")

ggplotly(graph_total_WLS_trend_covar_onlypost)
estimates_total_WLS_trend_covar_onlypost <- df_estimates #for robustness check

results_total_WLS_trend_covar_onlypost <- estimation_results # for only-post DID table

8 Y=total suicide rate (YOY)/男女合計の自殺率(前年同月差)

9 Y=total suicde rate(YOY)/男女合計の自殺率(前年同月差)with covar

10 Y=female suicide rate/女性の自殺率

10.5 WLS, with trends, post-covid-month dummies, Table C.1 (4)

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend(dataset = df_analysis, 
                    outcome_var = df_analysis$suicide_rate_female, 
                    treat_var = df_analysis$unemploy_shock_diff2)

texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3)
## 1 coefficient  not defined because the design matrix is rank deficient
## 
## ===========================================
##                                Model 1     
## -------------------------------------------
## treat_var:date_2020_02            0.022    
##                                  (0.097)   
## treat_var:date_2020_03           -0.068    
##                                  (0.086)   
## treat_var:date_2020_04           -0.011    
##                                  (0.089)   
## treat_var:date_2020_05            0.119    
##                                  (0.093)   
## treat_var:date_2020_06            0.025    
##                                  (0.063)   
## treat_var:date_2020_07            0.217    
##                                  (0.124)   
## treat_var:date_2020_08            0.022    
##                                  (0.089)   
## treat_var:date_2020_09           -0.033    
##                                  (0.079)   
## as.factor(id)1:year_month_id      0.008 ***
##                                  (0.002)   
## as.factor(id)2:year_month_id      0.000    
##                                  (0.001)   
## as.factor(id)3:year_month_id      0.005 ***
##                                  (0.001)   
## as.factor(id)4:year_month_id      0.008 ***
##                                  (0.002)   
## as.factor(id)5:year_month_id     -0.000    
##                                  (0.002)   
## as.factor(id)6:year_month_id      0.006 ***
##                                  (0.002)   
## as.factor(id)7:year_month_id      0.003    
##                                  (0.001)   
## as.factor(id)8:year_month_id     -0.004 ***
##                                  (0.001)   
## as.factor(id)9:year_month_id     -0.001    
##                                  (0.001)   
## as.factor(id)10:year_month_id     0.006 ***
##                                  (0.001)   
## as.factor(id)11:year_month_id     0.001    
##                                  (0.002)   
## as.factor(id)12:year_month_id     0.005 *  
##                                  (0.002)   
## as.factor(id)13:year_month_id    -0.002    
##                                  (0.002)   
## as.factor(id)14:year_month_id     0.001    
##                                  (0.003)   
## as.factor(id)15:year_month_id    -0.001    
##                                  (0.001)   
## as.factor(id)16:year_month_id     0.005 ***
##                                  (0.001)   
## as.factor(id)17:year_month_id    -0.003 ** 
##                                  (0.001)   
## as.factor(id)18:year_month_id    -0.004 ***
##                                  (0.001)   
## as.factor(id)19:year_month_id    -0.008 ***
##                                  (0.001)   
## as.factor(id)20:year_month_id    -0.004 ***
##                                  (0.001)   
## as.factor(id)21:year_month_id     0.003 ***
##                                  (0.001)   
## as.factor(id)22:year_month_id     0.004 ***
##                                  (0.001)   
## as.factor(id)23:year_month_id     0.002 *  
##                                  (0.001)   
## as.factor(id)24:year_month_id    -0.004 ***
##                                  (0.001)   
## as.factor(id)25:year_month_id     0.011 ***
##                                  (0.001)   
## as.factor(id)26:year_month_id    -0.002    
##                                  (0.002)   
## as.factor(id)27:year_month_id     0.005 *  
##                                  (0.002)   
## as.factor(id)28:year_month_id    -0.003    
##                                  (0.002)   
## as.factor(id)29:year_month_id     0.003    
##                                  (0.002)   
## as.factor(id)30:year_month_id    -0.001    
##                                  (0.002)   
## as.factor(id)31:year_month_id    -0.010 ***
##                                  (0.001)   
## as.factor(id)32:year_month_id              
##                                            
## as.factor(id)33:year_month_id    -0.004 ***
##                                  (0.001)   
## as.factor(id)34:year_month_id     0.001    
##                                  (0.001)   
## as.factor(id)35:year_month_id     0.003 ** 
##                                  (0.001)   
## as.factor(id)36:year_month_id     0.001    
##                                  (0.001)   
## as.factor(id)37:year_month_id     0.002    
##                                  (0.001)   
## as.factor(id)38:year_month_id    -0.000    
##                                  (0.001)   
## as.factor(id)39:year_month_id    -0.006 ***
##                                  (0.001)   
## as.factor(id)40:year_month_id     0.003    
##                                  (0.001)   
## as.factor(id)41:year_month_id    -0.013 ***
##                                  (0.000)   
## as.factor(id)42:year_month_id     0.013 ***
##                                  (0.001)   
## as.factor(id)43:year_month_id    -0.001    
##                                  (0.001)   
## as.factor(id)44:year_month_id     0.006 ***
##                                  (0.001)   
## as.factor(id)45:year_month_id     0.001    
##                                  (0.001)   
## as.factor(id)46:year_month_id    -0.003    
##                                  (0.002)   
## as.factor(id)47:year_month_id    -0.001    
##                                  (0.003)   
## -------------------------------------------
## R^2                               0.247    
## Adj. R^2                          0.176    
## Num. obs.                      1551        
## RMSE                             12.611    
## N Clusters                       47        
## ===========================================
## *** p < 0.001; ** p < 0.01; * p < 0.05
# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "unemploy_shock_diff2",
                                 estimation_label = "female_WLS_trend")

# Event study graph
graph_female_WLS_trend_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "female_WLS_trend")

ggplotly(graph_female_WLS_trend_onlypost)
estimates_female_WLS_trend_onlypost <- df_estimates #for robustness check

results_female_WLS_trend_onlypost <- estimation_results # for only-post DID table

11 Y=female suicide rate/女性の自殺率 with covar

11.5 WLS, with trends, post-covid-month dummies, Table C.2 (4)

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend_covar8Xcovid_months(dataset = df_analysis, 
                    outcome_var = df_analysis$suicide_rate_female, 
                    treat_var = df_analysis$unemploy_shock_diff2)

texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3)
## 1 coefficient  not defined because the design matrix is rank deficient
## 
## ====================================================================
##                                                         Model 1     
## --------------------------------------------------------------------
## treat_var:date_2020_02                                    -0.126    
##                                                           (0.142)   
## treat_var:date_2020_03                                    -0.104    
##                                                           (0.138)   
## treat_var:date_2020_04                                    -0.039    
##                                                           (0.140)   
## treat_var:date_2020_05                                     0.015    
##                                                           (0.118)   
## treat_var:date_2020_06                                     0.011    
##                                                           (0.118)   
## treat_var:date_2020_07                                     0.449 ** 
##                                                           (0.138)   
## treat_var:date_2020_08                                    -0.291    
##                                                           (0.177)   
## treat_var:date_2020_09                                     0.023    
##                                                           (0.131)   
## date_2020_02:google_mobility_index_2020may                -0.008    
##                                                           (0.024)   
## date_2020_03:google_mobility_index_2020may                -0.029    
##                                                           (0.024)   
## date_2020_04:google_mobility_index_2020may                -0.030    
##                                                           (0.032)   
## date_2020_05:google_mobility_index_2020may                -0.055    
##                                                           (0.030)   
## date_2020_06:google_mobility_index_2020may                 0.012    
##                                                           (0.021)   
## date_2020_07:google_mobility_index_2020may                -0.061 *  
##                                                           (0.023)   
## date_2020_08:google_mobility_index_2020may                 0.005    
##                                                           (0.033)   
## date_2020_09:google_mobility_index_2020may                -0.013    
##                                                           (0.026)   
## date_2020_02:infection_rate_cumulative2020jun             -0.028    
##                                                           (0.018)   
## date_2020_03:infection_rate_cumulative2020jun             -0.025    
##                                                           (0.017)   
## date_2020_04:infection_rate_cumulative2020jun             -0.036 *  
##                                                           (0.015)   
## date_2020_05:infection_rate_cumulative2020jun             -0.015    
##                                                           (0.015)   
## date_2020_06:infection_rate_cumulative2020jun             -0.004    
##                                                           (0.014)   
## date_2020_07:infection_rate_cumulative2020jun             -0.031    
##                                                           (0.021)   
## date_2020_08:infection_rate_cumulative2020jun              0.011    
##                                                           (0.021)   
## date_2020_09:infection_rate_cumulative2020jun              0.011    
##                                                           (0.016)   
## date_2020_02:death_rate_cumulative2020jun                  0.256    
##                                                           (0.197)   
## date_2020_03:death_rate_cumulative2020jun                  0.121    
##                                                           (0.198)   
## date_2020_04:death_rate_cumulative2020jun                  0.417 *  
##                                                           (0.170)   
## date_2020_05:death_rate_cumulative2020jun                 -0.020    
##                                                           (0.161)   
## date_2020_06:death_rate_cumulative2020jun                  0.229    
##                                                           (0.154)   
## date_2020_07:death_rate_cumulative2020jun                  0.363    
##                                                           (0.237)   
## date_2020_08:death_rate_cumulative2020jun                 -0.155    
##                                                           (0.234)   
## date_2020_09:death_rate_cumulative2020jun                 -0.154    
##                                                           (0.186)   
## date_2020_02:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_03:Population_per_1_km_2_of_inhabitable_area    -0.000    
##                                                           (0.000)   
## date_2020_04:Population_per_1_km_2_of_inhabitable_area    -0.000    
##                                                           (0.000)   
## date_2020_05:Population_per_1_km_2_of_inhabitable_area    -0.000    
##                                                           (0.000)   
## date_2020_06:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_07:Population_per_1_km_2_of_inhabitable_area    -0.000    
##                                                           (0.000)   
## date_2020_08:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_09:Population_per_1_km_2_of_inhabitable_area    -0.000 *  
##                                                           (0.000)   
## date_2020_02:Secondary_industry_ratio                      0.294    
##                                                           (1.799)   
## date_2020_03:Secondary_industry_ratio                     -1.998    
##                                                           (1.824)   
## date_2020_04:Secondary_industry_ratio                      1.114    
##                                                           (2.146)   
## date_2020_05:Secondary_industry_ratio                      1.033    
##                                                           (2.068)   
## date_2020_06:Secondary_industry_ratio                      2.066    
##                                                           (1.864)   
## date_2020_07:Secondary_industry_ratio                     -3.255    
##                                                           (2.088)   
## date_2020_08:Secondary_industry_ratio                      3.769    
##                                                           (2.288)   
## date_2020_09:Secondary_industry_ratio                      0.989    
##                                                           (2.104)   
## date_2020_02:Tertiary_industry_ratio                       1.121    
##                                                           (2.787)   
## date_2020_03:Tertiary_industry_ratio                      -2.025    
##                                                           (2.082)   
## date_2020_04:Tertiary_industry_ratio                       1.653    
##                                                           (2.743)   
## date_2020_05:Tertiary_industry_ratio                       0.753    
##                                                           (2.216)   
## date_2020_06:Tertiary_industry_ratio                       2.391    
##                                                           (1.846)   
## date_2020_07:Tertiary_industry_ratio                      -6.519 *  
##                                                           (2.972)   
## date_2020_08:Tertiary_industry_ratio                       6.189    
##                                                           (3.487)   
## date_2020_09:Tertiary_industry_ratio                       0.006    
##                                                           (2.419)   
## date_2020_02:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_03:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_04:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_05:Total_population                              0.001 ***
##                                                           (0.000)   
## date_2020_06:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_07:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_08:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_09:Total_population                              0.001 *  
##                                                           (0.000)   
## date_2020_02:Ratio_of_aged_population                      0.007    
##                                                           (0.011)   
## date_2020_03:Ratio_of_aged_population                      0.015    
##                                                           (0.013)   
## date_2020_04:Ratio_of_aged_population                      0.010    
##                                                           (0.014)   
## date_2020_05:Ratio_of_aged_population                      0.048 ** 
##                                                           (0.015)   
## date_2020_06:Ratio_of_aged_population                      0.012    
##                                                           (0.010)   
## date_2020_07:Ratio_of_aged_population                      0.021    
##                                                           (0.012)   
## date_2020_08:Ratio_of_aged_population                     -0.001    
##                                                           (0.015)   
## date_2020_09:Ratio_of_aged_population                      0.028    
##                                                           (0.014)   
## as.factor(id)1:year_month_id                               0.011 ***
##                                                           (0.003)   
## as.factor(id)2:year_month_id                               0.011 ***
##                                                           (0.001)   
## as.factor(id)3:year_month_id                               0.014 ***
##                                                           (0.001)   
## as.factor(id)4:year_month_id                               0.017 ***
##                                                           (0.002)   
## as.factor(id)5:year_month_id                               0.005 *  
##                                                           (0.002)   
## as.factor(id)6:year_month_id                               0.015 ***
##                                                           (0.002)   
## as.factor(id)7:year_month_id                               0.011 ***
##                                                           (0.002)   
## as.factor(id)8:year_month_id                               0.002    
##                                                           (0.002)   
## as.factor(id)9:year_month_id                               0.009 ***
##                                                           (0.002)   
## as.factor(id)10:year_month_id                              0.011 ***
##                                                           (0.003)   
## as.factor(id)11:year_month_id                              0.007 ***
##                                                           (0.002)   
## as.factor(id)12:year_month_id                              0.009 ** 
##                                                           (0.003)   
## as.factor(id)13:year_month_id                              0.005 ** 
##                                                           (0.002)   
## as.factor(id)14:year_month_id                              0.007 ** 
##                                                           (0.002)   
## as.factor(id)15:year_month_id                              0.005 *  
##                                                           (0.002)   
## as.factor(id)16:year_month_id                              0.010 *  
##                                                           (0.005)   
## as.factor(id)17:year_month_id                              0.004    
##                                                           (0.004)   
## as.factor(id)18:year_month_id                              0.006    
##                                                           (0.003)   
## as.factor(id)19:year_month_id                              0.001    
##                                                           (0.003)   
## as.factor(id)20:year_month_id                             -0.000    
##                                                           (0.003)   
## as.factor(id)21:year_month_id                              0.009 ***
##                                                           (0.003)   
## as.factor(id)22:year_month_id                              0.007 ** 
##                                                           (0.003)   
## as.factor(id)23:year_month_id                              0.007 ** 
##                                                           (0.002)   
## as.factor(id)24:year_month_id                              0.002    
##                                                           (0.002)   
## as.factor(id)25:year_month_id                              0.024 ***
##                                                           (0.002)   
## as.factor(id)26:year_month_id                              0.006 ** 
##                                                           (0.002)   
## as.factor(id)27:year_month_id                              0.012 ***
##                                                           (0.002)   
## as.factor(id)28:year_month_id                              0.001    
##                                                           (0.003)   
## as.factor(id)29:year_month_id                              0.013 ***
##                                                           (0.003)   
## as.factor(id)30:year_month_id                              0.008 ***
##                                                           (0.002)   
## as.factor(id)31:year_month_id                                       
##                                                                     
## as.factor(id)32:year_month_id                              0.004    
##                                                           (0.002)   
## as.factor(id)33:year_month_id                              0.004 ** 
##                                                           (0.001)   
## as.factor(id)34:year_month_id                              0.007 ***
##                                                           (0.002)   
## as.factor(id)35:year_month_id                              0.007 *  
##                                                           (0.003)   
## as.factor(id)36:year_month_id                              0.006 ***
##                                                           (0.002)   
## as.factor(id)37:year_month_id                              0.008 ***
##                                                           (0.002)   
## as.factor(id)38:year_month_id                              0.007 ***
##                                                           (0.001)   
## as.factor(id)39:year_month_id                             -0.001    
##                                                           (0.002)   
## as.factor(id)40:year_month_id                              0.010 ***
##                                                           (0.002)   
## as.factor(id)41:year_month_id                             -0.003 *  
##                                                           (0.001)   
## as.factor(id)42:year_month_id                              0.019 ***
##                                                           (0.001)   
## as.factor(id)43:year_month_id                              0.006 ***
##                                                           (0.001)   
## as.factor(id)44:year_month_id                              0.014 ***
##                                                           (0.001)   
## as.factor(id)45:year_month_id                              0.010 ***
##                                                           (0.001)   
## as.factor(id)46:year_month_id                              0.004 ***
##                                                           (0.001)   
## as.factor(id)47:year_month_id                              0.014 ***
##                                                           (0.003)   
## --------------------------------------------------------------------
## R^2                                                        0.287    
## Adj. R^2                                                   0.184    
## Num. obs.                                               1551        
## RMSE                                                      12.557    
## N Clusters                                                47        
## ====================================================================
## *** p < 0.001; ** p < 0.01; * p < 0.05
# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "unemploy_shock_diff2",
                                 estimation_label = "female_WLS_trend")

# Event study graph
graph_female_WLS_trend_covar_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "female_WLS_trend")

ggplotly(graph_female_WLS_trend_covar_onlypost)
estimates_female_WLS_trend_covar_onlypost <- df_estimates #for robustness check

results_female_WLS_trend_covar_onlypost <- estimation_results # for only-post DID table

12 Y=female suicide rate(YOY)/女性合計の自殺率(前年同月差)

13 Y=female suicide rate(YOY)/女性合計の自殺率(前年同月差)with covar

14 Y=male suicide rate/男性の自殺率

14.5 WLS, with trends, post-covid-month dummies, Table C.1 (6)

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend(dataset = df_analysis, 
                    outcome_var = df_analysis$suicide_rate_male, 
                    treat_var = df_analysis$unemploy_shock_diff2)

texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3)
## 1 coefficient  not defined because the design matrix is rank deficient
## 
## ===========================================
##                                Model 1     
## -------------------------------------------
## treat_var:date_2020_02           -0.038    
##                                  (0.123)   
## treat_var:date_2020_03           -0.037    
##                                  (0.165)   
## treat_var:date_2020_04            0.043    
##                                  (0.118)   
## treat_var:date_2020_05            0.198    
##                                  (0.176)   
## treat_var:date_2020_06            0.474 ***
##                                  (0.134)   
## treat_var:date_2020_07            0.396 *  
##                                  (0.152)   
## treat_var:date_2020_08            0.090    
##                                  (0.193)   
## treat_var:date_2020_09            0.024    
##                                  (0.155)   
## as.factor(id)1:year_month_id     -0.031 ***
##                                  (0.005)   
## as.factor(id)2:year_month_id     -0.031 ***
##                                  (0.003)   
## as.factor(id)3:year_month_id     -0.024 ***
##                                  (0.003)   
## as.factor(id)4:year_month_id     -0.027 ***
##                                  (0.004)   
## as.factor(id)5:year_month_id     -0.017 ***
##                                  (0.003)   
## as.factor(id)6:year_month_id     -0.032 ***
##                                  (0.003)   
## as.factor(id)7:year_month_id     -0.030 ***
##                                  (0.003)   
## as.factor(id)8:year_month_id     -0.029 ***
##                                  (0.002)   
## as.factor(id)9:year_month_id     -0.025 ***
##                                  (0.002)   
## as.factor(id)10:year_month_id    -0.022 ***
##                                  (0.001)   
## as.factor(id)11:year_month_id    -0.032 ***
##                                  (0.004)   
## as.factor(id)12:year_month_id    -0.034 ***
##                                  (0.004)   
## as.factor(id)13:year_month_id    -0.039 ***
##                                  (0.004)   
## as.factor(id)14:year_month_id    -0.028 ***
##                                  (0.006)   
## as.factor(id)15:year_month_id    -0.033 ***
##                                  (0.003)   
## as.factor(id)16:year_month_id    -0.011 ***
##                                  (0.003)   
## as.factor(id)17:year_month_id    -0.005 *  
##                                  (0.002)   
## as.factor(id)18:year_month_id    -0.005 ** 
##                                  (0.002)   
## as.factor(id)19:year_month_id    -0.020 ***
##                                  (0.002)   
## as.factor(id)20:year_month_id    -0.019 ***
##                                  (0.002)   
## as.factor(id)21:year_month_id    -0.025 ***
##                                  (0.002)   
## as.factor(id)22:year_month_id    -0.024 ***
##                                  (0.002)   
## as.factor(id)23:year_month_id    -0.022 ***
##                                  (0.002)   
## as.factor(id)24:year_month_id    -0.023 ***
##                                  (0.002)   
## as.factor(id)25:year_month_id    -0.033 ***
##                                  (0.002)   
## as.factor(id)26:year_month_id    -0.022 ***
##                                  (0.004)   
## as.factor(id)27:year_month_id    -0.017 ** 
##                                  (0.005)   
## as.factor(id)28:year_month_id    -0.032 ***
##                                  (0.004)   
## as.factor(id)29:year_month_id    -0.036 ***
##                                  (0.005)   
## as.factor(id)30:year_month_id    -0.042 ***
##                                  (0.005)   
## as.factor(id)31:year_month_id    -0.022 ***
##                                  (0.003)   
## as.factor(id)32:year_month_id              
##                                            
## as.factor(id)33:year_month_id    -0.023 ***
##                                  (0.002)   
## as.factor(id)34:year_month_id    -0.028 ***
##                                  (0.002)   
## as.factor(id)35:year_month_id    -0.025 ***
##                                  (0.003)   
## as.factor(id)36:year_month_id    -0.021 ***
##                                  (0.003)   
## as.factor(id)37:year_month_id    -0.032 ***
##                                  (0.003)   
## as.factor(id)38:year_month_id    -0.029 ***
##                                  (0.003)   
## as.factor(id)39:year_month_id    -0.011 ***
##                                  (0.002)   
## as.factor(id)40:year_month_id    -0.027 ***
##                                  (0.003)   
## as.factor(id)41:year_month_id    -0.046 ***
##                                  (0.001)   
## as.factor(id)42:year_month_id    -0.010 ***
##                                  (0.002)   
## as.factor(id)43:year_month_id    -0.006 ** 
##                                  (0.002)   
## as.factor(id)44:year_month_id    -0.046 ***
##                                  (0.003)   
## as.factor(id)45:year_month_id    -0.019 ***
##                                  (0.002)   
## as.factor(id)46:year_month_id    -0.011 ** 
##                                  (0.004)   
## as.factor(id)47:year_month_id    -0.022 ***
##                                  (0.006)   
## -------------------------------------------
## R^2                               0.429    
## Adj. R^2                          0.376    
## Num. obs.                      1551        
## RMSE                             20.677    
## N Clusters                       47        
## ===========================================
## *** p < 0.001; ** p < 0.01; * p < 0.05
# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "unemploy_shock_diff2",
                                 estimation_label = "male_WLS_trend")

# Event study graph
graph_male_WLS_trend_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "male_WLS_trend")

ggplotly(graph_male_WLS_trend_onlypost)
estimates_male_WLS_trend_onlypost <- df_estimates #for robustness check

results_male_WLS_trend_onlypost <- estimation_results # for only-post DID table

15 Y=male suicide rate/男性の自殺率 with covar

15.5 WLS, with trends, post-covid-month dummies,Table C.2 (6)

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend_covar8Xcovid_months(dataset = df_analysis, 
                    outcome_var = df_analysis$suicide_rate_male, 
                    treat_var = df_analysis$unemploy_shock_diff2)

texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3)
## 1 coefficient  not defined because the design matrix is rank deficient
## 
## ====================================================================
##                                                         Model 1     
## --------------------------------------------------------------------
## treat_var:date_2020_02                                    -0.478    
##                                                           (0.238)   
## treat_var:date_2020_03                                    -0.130    
##                                                           (0.289)   
## treat_var:date_2020_04                                     0.008    
##                                                           (0.204)   
## treat_var:date_2020_05                                     0.140    
##                                                           (0.308)   
## treat_var:date_2020_06                                     0.157    
##                                                           (0.267)   
## treat_var:date_2020_07                                     0.344    
##                                                           (0.249)   
## treat_var:date_2020_08                                    -0.248    
##                                                           (0.317)   
## treat_var:date_2020_09                                    -0.147    
##                                                           (0.277)   
## date_2020_02:google_mobility_index_2020may                 0.018    
##                                                           (0.041)   
## date_2020_03:google_mobility_index_2020may                 0.052    
##                                                           (0.050)   
## date_2020_04:google_mobility_index_2020may                 0.059    
##                                                           (0.040)   
## date_2020_05:google_mobility_index_2020may                -0.012    
##                                                           (0.051)   
## date_2020_06:google_mobility_index_2020may                 0.052    
##                                                           (0.032)   
## date_2020_07:google_mobility_index_2020may                 0.051    
##                                                           (0.051)   
## date_2020_08:google_mobility_index_2020may                 0.119 *  
##                                                           (0.058)   
## date_2020_09:google_mobility_index_2020may                 0.041    
##                                                           (0.054)   
## date_2020_02:infection_rate_cumulative2020jun             -0.011    
##                                                           (0.023)   
## date_2020_03:infection_rate_cumulative2020jun              0.018    
##                                                           (0.035)   
## date_2020_04:infection_rate_cumulative2020jun             -0.005    
##                                                           (0.024)   
## date_2020_05:infection_rate_cumulative2020jun             -0.035    
##                                                           (0.037)   
## date_2020_06:infection_rate_cumulative2020jun              0.031    
##                                                           (0.025)   
## date_2020_07:infection_rate_cumulative2020jun              0.041    
##                                                           (0.024)   
## date_2020_08:infection_rate_cumulative2020jun              0.004    
##                                                           (0.037)   
## date_2020_09:infection_rate_cumulative2020jun              0.021    
##                                                           (0.030)   
## date_2020_02:death_rate_cumulative2020jun                 -0.005    
##                                                           (0.227)   
## date_2020_03:death_rate_cumulative2020jun                 -0.080    
##                                                           (0.371)   
## date_2020_04:death_rate_cumulative2020jun                  0.144    
##                                                           (0.267)   
## date_2020_05:death_rate_cumulative2020jun                  0.295    
##                                                           (0.464)   
## date_2020_06:death_rate_cumulative2020jun                 -0.152    
##                                                           (0.290)   
## date_2020_07:death_rate_cumulative2020jun                 -0.661 *  
##                                                           (0.293)   
## date_2020_08:death_rate_cumulative2020jun                  0.103    
##                                                           (0.472)   
## date_2020_09:death_rate_cumulative2020jun                 -0.216    
##                                                           (0.335)   
## date_2020_02:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_03:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_04:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_05:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_06:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_07:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_08:Population_per_1_km_2_of_inhabitable_area     0.000 *  
##                                                           (0.000)   
## date_2020_09:Population_per_1_km_2_of_inhabitable_area     0.000    
##                                                           (0.000)   
## date_2020_02:Secondary_industry_ratio                     -3.177    
##                                                           (3.253)   
## date_2020_03:Secondary_industry_ratio                      2.228    
##                                                           (4.419)   
## date_2020_04:Secondary_industry_ratio                     -0.003    
##                                                           (3.080)   
## date_2020_05:Secondary_industry_ratio                     -0.450    
##                                                           (3.713)   
## date_2020_06:Secondary_industry_ratio                      4.177    
##                                                           (2.465)   
## date_2020_07:Secondary_industry_ratio                     -4.423    
##                                                           (2.983)   
## date_2020_08:Secondary_industry_ratio                     -0.176    
##                                                           (2.839)   
## date_2020_09:Secondary_industry_ratio                     -0.577    
##                                                           (2.959)   
## date_2020_02:Tertiary_industry_ratio                       0.041    
##                                                           (4.126)   
## date_2020_03:Tertiary_industry_ratio                       3.650    
##                                                           (5.170)   
## date_2020_04:Tertiary_industry_ratio                       2.502    
##                                                           (3.100)   
## date_2020_05:Tertiary_industry_ratio                      -2.470    
##                                                           (5.547)   
## date_2020_06:Tertiary_industry_ratio                       5.608    
##                                                           (3.249)   
## date_2020_07:Tertiary_industry_ratio                      -5.196    
##                                                           (4.060)   
## date_2020_08:Tertiary_industry_ratio                       3.092    
##                                                           (4.406)   
## date_2020_09:Tertiary_industry_ratio                       0.949    
##                                                           (3.835)   
## date_2020_02:Total_population                              0.000    
##                                                           (0.001)   
## date_2020_03:Total_population                             -0.000    
##                                                           (0.001)   
## date_2020_04:Total_population                             -0.000    
##                                                           (0.001)   
## date_2020_05:Total_population                              0.000    
##                                                           (0.001)   
## date_2020_06:Total_population                              0.000    
##                                                           (0.000)   
## date_2020_07:Total_population                             -0.000    
##                                                           (0.001)   
## date_2020_08:Total_population                             -0.000    
##                                                           (0.001)   
## date_2020_09:Total_population                              0.000    
##                                                           (0.001)   
## date_2020_02:Ratio_of_aged_population                     -0.021    
##                                                           (0.027)   
## date_2020_03:Ratio_of_aged_population                     -0.015    
##                                                           (0.030)   
## date_2020_04:Ratio_of_aged_population                     -0.008    
##                                                           (0.023)   
## date_2020_05:Ratio_of_aged_population                      0.023    
##                                                           (0.024)   
## date_2020_06:Ratio_of_aged_population                     -0.013    
##                                                           (0.017)   
## date_2020_07:Ratio_of_aged_population                     -0.004    
##                                                           (0.025)   
## date_2020_08:Ratio_of_aged_population                     -0.039    
##                                                           (0.026)   
## date_2020_09:Ratio_of_aged_population                     -0.015    
##                                                           (0.028)   
## as.factor(id)1:year_month_id                               0.001    
##                                                           (0.006)   
## as.factor(id)2:year_month_id                              -0.014 ***
##                                                           (0.003)   
## as.factor(id)3:year_month_id                              -0.003    
##                                                           (0.002)   
## as.factor(id)4:year_month_id                               0.000    
##                                                           (0.004)   
## as.factor(id)5:year_month_id                               0.005    
##                                                           (0.005)   
## as.factor(id)6:year_month_id                              -0.007    
##                                                           (0.007)   
## as.factor(id)7:year_month_id                              -0.002    
##                                                           (0.006)   
## as.factor(id)8:year_month_id                              -0.001    
##                                                           (0.004)   
## as.factor(id)9:year_month_id                               0.003    
##                                                           (0.005)   
## as.factor(id)10:year_month_id                              0.007    
##                                                           (0.006)   
## as.factor(id)11:year_month_id                             -0.005    
##                                                           (0.005)   
## as.factor(id)12:year_month_id                             -0.003    
##                                                           (0.007)   
## as.factor(id)13:year_month_id                             -0.018 ***
##                                                           (0.005)   
## as.factor(id)14:year_month_id                             -0.002    
##                                                           (0.005)   
## as.factor(id)15:year_month_id                             -0.008    
##                                                           (0.005)   
## as.factor(id)16:year_month_id                              0.021 ** 
##                                                           (0.007)   
## as.factor(id)17:year_month_id                              0.026 ***
##                                                           (0.007)   
## as.factor(id)18:year_month_id                              0.015 ** 
##                                                           (0.005)   
## as.factor(id)19:year_month_id                              0.011    
##                                                           (0.007)   
## as.factor(id)20:year_month_id                              0.011    
##                                                           (0.007)   
## as.factor(id)21:year_month_id                              0.003    
##                                                           (0.006)   
## as.factor(id)22:year_month_id                              0.005    
##                                                           (0.007)   
## as.factor(id)23:year_month_id                              0.002    
##                                                           (0.005)   
## as.factor(id)24:year_month_id                              0.006    
##                                                           (0.005)   
## as.factor(id)25:year_month_id                             -0.008    
##                                                           (0.006)   
## as.factor(id)26:year_month_id                              0.011    
##                                                           (0.006)   
## as.factor(id)27:year_month_id                              0.006    
##                                                           (0.005)   
## as.factor(id)28:year_month_id                             -0.003    
##                                                           (0.005)   
## as.factor(id)29:year_month_id                             -0.009    
##                                                           (0.004)   
## as.factor(id)30:year_month_id                             -0.013 ** 
##                                                           (0.005)   
## as.factor(id)31:year_month_id                                       
##                                                                     
## as.factor(id)32:year_month_id                              0.020 *  
##                                                           (0.008)   
## as.factor(id)33:year_month_id                              0.003    
##                                                           (0.003)   
## as.factor(id)34:year_month_id                             -0.002    
##                                                           (0.005)   
## as.factor(id)35:year_month_id                              0.002    
##                                                           (0.006)   
## as.factor(id)36:year_month_id                              0.008    
##                                                           (0.004)   
## as.factor(id)37:year_month_id                             -0.003    
##                                                           (0.005)   
## as.factor(id)38:year_month_id                             -0.004    
##                                                           (0.003)   
## as.factor(id)39:year_month_id                              0.014 ** 
##                                                           (0.004)   
## as.factor(id)40:year_month_id                             -0.002    
##                                                           (0.005)   
## as.factor(id)41:year_month_id                             -0.026 ***
##                                                           (0.003)   
## as.factor(id)42:year_month_id                              0.012 *  
##                                                           (0.005)   
## as.factor(id)43:year_month_id                              0.017 ***
##                                                           (0.003)   
## as.factor(id)44:year_month_id                             -0.021 ***
##                                                           (0.003)   
## as.factor(id)45:year_month_id                              0.002    
##                                                           (0.002)   
## as.factor(id)46:year_month_id                              0.013 ***
##                                                           (0.002)   
## as.factor(id)47:year_month_id                              0.014    
##                                                           (0.010)   
## --------------------------------------------------------------------
## R^2                                                        0.451    
## Adj. R^2                                                   0.371    
## Num. obs.                                               1551        
## RMSE                                                      20.751    
## N Clusters                                                47        
## ====================================================================
## *** p < 0.001; ** p < 0.01; * p < 0.05
# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "unemploy_shock_diff2",
                                 estimation_label = "male_WLS_trend")

# Event study graph
graph_male_WLS_trend_covar_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "male_WLS_trend")

ggplotly(graph_male_WLS_trend_covar_onlypost)
estimates_male_WLS_trend_covar_onlypost <- df_estimates #for robustness check

results_male_WLS_trend_covar_onlypost <- estimation_results # for only-post DID table

16 Y=male suicide rate(YOY)/男性計の自殺率(前年同月差)

17 Y=male suicide rate(YOY)/男性計の自殺率(前年同月差)with covar

17.5 GGplotly

ggplotly(graph_total_WLS_trend)
ggplotly(graph_total_WLS_trend_covar)
ggplotly(graph_female_WLS_trend)
ggplotly(graph_female_WLS_trend_covar)
ggplotly(graph_male_WLS_trend)
ggplotly(graph_male_WLS_trend_covar)

18 Merge outcome results/アウトカム結果の結合

18.1 Y=total suicide rate/男女合計の自殺率

#merge and label estimates data
estimates_total_bind <- dplyr::bind_rows(estimates_total_OLS_notrend, 
                                         estimates_total_WLS_notrend, 
                                         estimates_total_OLS_trend,
                                         estimates_total_WLS_trend)

#change labels and reorder labels
estimates_total_bind <- estimates_labeling_main(estimates_total_bind)

# Display results
DT::datatable(estimates_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_total_bind <- event_study_graph_bind_main(data = estimates_total_bind, 
                                             graph_title = "(a) Total suicide rate")

ggplotly(graph_total_bind)
#ggplotly(graph_total_bind)

18.2 Y=total suicide rate/男女合計の自殺率 with covar

#merge and label estimates data
estimates_total_bind <- dplyr::bind_rows(estimates_total_OLS_notrend_covar, 
                                         estimates_total_WLS_notrend_covar, 
                                         estimates_total_OLS_trend_covar,
                                         estimates_total_WLS_trend_covar)

#change labels and reorder labels
estimates_total_bind <- estimates_labeling_main(estimates_total_bind)

# Display results
DT::datatable(estimates_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_total_bind_covar <- event_study_graph_bind_main(data = estimates_total_bind, 
                                             graph_title = "(a) Total suicide rate")

ggplotly(graph_total_bind_covar)

18.3 Y=total suicide rate(YOY)/男女合計の自殺率(対前年同期差)

#merge and label estimates data
estimates_yoy_total_bind <- dplyr::bind_rows(estimates_yoy_total_OLS_notrend, 
                                             estimates_yoy_total_WLS_notrend, 
                                             estimates_yoy_total_OLS_trend,
                                             estimates_yoy_total_WLS_trend)

#change labels and reorder labels
estimates_yoy_total_bind <- estimates_labeling_main(estimates_yoy_total_bind)

# display results
DT::datatable(estimates_yoy_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_total_bind <- event_study_graph_bind_main(data = estimates_yoy_total_bind, 
                                             graph_title = "(b) Total suicide rate (year-on-year)")

ggplotly(graph_yoy_total_bind)

18.4 Y=total suicide rate(YOY)/男女合計の自殺率(対前年同期差) with covar

#merge and label estimates data
estimates_yoy_total_bind <- dplyr::bind_rows(estimates_yoy_total_OLS_notrend_covar, 
                                             estimates_yoy_total_WLS_notrend_covar, 
                                             estimates_yoy_total_OLS_trend_covar,
                                             estimates_yoy_total_WLS_trend_covar)

#change labels and reorder labels
estimates_yoy_total_bind <- estimates_labeling_main(estimates_yoy_total_bind)

# display results
DT::datatable(estimates_yoy_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_total_bind_covar <- event_study_graph_bind_main(data = estimates_yoy_total_bind, 
                                             graph_title = "(b) Total suicide rate (year-on-year)")

ggplotly(graph_yoy_total_bind_covar)

18.5 Y=female suicide rate/女性の自殺率

#merge and label estimates data
estimates_female_bind <- dplyr::bind_rows(estimates_female_OLS_notrend, 
                                          estimates_female_WLS_notrend, 
                                          estimates_female_OLS_trend,
                                          estimates_female_WLS_trend)

#change labels and reorder labels
estimates_female_bind <- estimates_labeling_main(estimates_female_bind)

# display results
DT::datatable(estimates_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_female_bind <- event_study_graph_bind_main(data = estimates_female_bind, 
                                             graph_title = "(c) Female suicide rate")

ggplotly(graph_female_bind)

18.6 Y=female suicide rate/女性の自殺率 with covar

#merge and label estimates data
estimates_female_bind <- dplyr::bind_rows(estimates_female_OLS_notrend_covar, 
                                          estimates_female_WLS_notrend_covar, 
                                          estimates_female_OLS_trend_covar,
                                          estimates_female_WLS_trend_covar)

#change labels and reorder labels
estimates_female_bind <- estimates_labeling_main(estimates_female_bind)

# display results
DT::datatable(estimates_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_female_bind_covar <- event_study_graph_bind_main(data = estimates_female_bind, 
                                             graph_title = "(c) Female suicide rate")

ggplotly(graph_female_bind_covar)

18.7 Y=female suicide rate(YOY)/女性の自殺率(対前年同期差)

#merge and label estimates data
estimates_yoy_female_bind <- dplyr::bind_rows(estimates_yoy_female_OLS_notrend, 
                                              estimates_yoy_female_WLS_notrend, 
                                              estimates_yoy_female_OLS_trend,
                                              estimates_yoy_female_WLS_trend)

#change labels and reorder labels
estimates_yoy_female_bind <- estimates_labeling_main(estimates_yoy_female_bind)


# display results
DT::datatable(estimates_yoy_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_female_bind <- event_study_graph_bind_main(data = estimates_yoy_female_bind, 
                                             graph_title = "(d) Female suicide rate (year-on-year)")

ggplotly(graph_yoy_female_bind)

18.8 Y=female suicide rate(YOY)/女性の自殺率(対前年同期差) with covar

#merge and label estimates data
estimates_yoy_female_bind <- dplyr::bind_rows(estimates_yoy_female_OLS_notrend_covar, 
                                              estimates_yoy_female_WLS_notrend_covar, 
                                              estimates_yoy_female_OLS_trend_covar,
                                              estimates_yoy_female_WLS_trend_covar)

#change labels and reorder labels
estimates_yoy_female_bind <- estimates_labeling_main(estimates_yoy_female_bind)


# display results
DT::datatable(estimates_yoy_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_female_bind_covar <- event_study_graph_bind_main(data = estimates_yoy_female_bind, 
                                             graph_title = "(d) Female suicide rate (year-on-year)")

ggplotly(graph_yoy_female_bind_covar)

18.9 Y=male suicide rate/男性の自殺率

#merge and label estimates data
estimates_male_bind <- dplyr::bind_rows(estimates_male_OLS_notrend, 
                                        estimates_male_WLS_notrend, 
                                        estimates_male_OLS_trend,
                                        estimates_male_WLS_trend)

#change labels and reorder labels
estimates_male_bind <- estimates_labeling_main(estimates_male_bind)


# display results
DT::datatable(estimates_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_male_bind <- event_study_graph_bind_main(data = estimates_male_bind, 
                                             graph_title = "(e) Male Suicide rate")

ggplotly(graph_male_bind)

18.10 Y=male suicide rate/男性の自殺率 with covar

#merge and label estimates data
estimates_male_bind <- dplyr::bind_rows(estimates_male_OLS_notrend_covar, 
                                        estimates_male_WLS_notrend_covar, 
                                        estimates_male_OLS_trend_covar,
                                        estimates_male_WLS_trend_covar)

#change labels and reorder labels
estimates_male_bind <- estimates_labeling_main(estimates_male_bind)


# display results
DT::datatable(estimates_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_male_bind_covar <- event_study_graph_bind_main(data = estimates_male_bind, 
                                             graph_title = "(e) Male Suicide rate")

ggplotly(graph_male_bind_covar)

18.11 Y=male suicide rate(YOY)/男性の自殺率(対前年同期差)

#merge and label estimates data
estimates_yoy_male_bind <- dplyr::bind_rows(estimates_yoy_male_OLS_notrend, 
                                            estimates_yoy_male_WLS_notrend, 
                                            estimates_yoy_male_OLS_trend,
                                            estimates_yoy_male_WLS_trend)

#change labels and reorder labels
estimates_yoy_male_bind <- estimates_labeling_main(estimates_yoy_male_bind)


# display results
DT::datatable(estimates_yoy_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_male_bind <- event_study_graph_bind_main(data = estimates_yoy_male_bind, 
                                             graph_title = "(f) Male Suicide rate (year-on-year)")

ggplotly(graph_yoy_male_bind)

18.12 Y=male suicide rate(YOY)/男性の自殺率(対前年同期差) with covar

#merge and label estimates data
estimates_yoy_male_bind <- dplyr::bind_rows(estimates_yoy_male_OLS_notrend_covar, 
                                            estimates_yoy_male_WLS_notrend_covar, 
                                            estimates_yoy_male_OLS_trend_covar,
                                            estimates_yoy_male_WLS_trend_covar)

#change labels and reorder labels
estimates_yoy_male_bind <- estimates_labeling_main(estimates_yoy_male_bind)


# display results
DT::datatable(estimates_yoy_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_male_bind_covar <- event_study_graph_bind_main(data = estimates_yoy_male_bind, 
                                             graph_title = "(f) Male Suicide rate (year-on-year)")

ggplotly(graph_yoy_male_bind_covar)

19 Merge graphs/グラフ統合

20 Extract legend/legend取り出し

#Legendの表示
graph_for_legend  <- graph_total_bind +
 theme(legend.position = 'bottom', # Adjust x axis label
       legend.title = element_text(colour = "black", size = 20),
       legend.text = element_text(color = "black", size = 20))
graph_for_legend  

#extract legend
legend_model_types <- ggpubr::get_legend(graph_for_legend)
legend_model_types <- ggpubr::as_ggplot(legend_model_types)
legend_model_types

#2行Legendの表示
graph_for_legend_2row  <- graph_total_bind +
 theme(legend.position = 'bottom', # Adjust x axis label
       legend.title = element_text(colour = "black", size = 20),
       legend.text = element_text(color = "black", size = 20))+
  guides(color = guide_legend(nrow = 2, byrow = TRUE)) #legendを二行に変更 2021Sep7 Waki 
graph_for_legend_2row  

#extract legend
legend_2row_model_types <- ggpubr::get_legend(graph_for_legend_2row)
legend_2row_model_types <- ggpubr::as_ggplot(legend_2row_model_types)
legend_2row_model_types

20.1 Merge/統合

グラフを統合して論文用に保存。 ### graph size

dpi_num <- 100
width_num <- 15
height_num <- 20

20.1.3 Robustness check

ymin <- - 1.5
ymax <- 1.6

ymin_num <- - 1.5
ymax_num  <- 1.5
interval <- 0.5


graph_total_bind <- graph_total_bind + 
  labs(title = "(a) Total") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_total_bind_covar <- graph_total_bind_covar + 
  labs(title = "(b) Total, with covaraites") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))


graph_female_bind <- graph_female_bind + 
  labs(title = "(c) Female")+ 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_female_bind_covar <- graph_female_bind_covar + 
  labs(title = "(d) Female, with covaraites") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_male_bind <- graph_male_bind + 
  labs(title = "(e) Male")+ 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_male_bind_covar <- graph_male_bind_covar + 
  labs(title = "(f) Male, with covaraites") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph <- (graph_total_bind | graph_total_bind_covar) / 
  (graph_female_bind| graph_female_bind_covar) / 
  (graph_male_bind| graph_male_bind_covar) /
  legend_model_types +
  plot_layout(heights = c(2, 2, 2, 0.5))

graph

#保存

ggsave(file = "output/graph_unemploy_diff2_on_suicide_robust.pdf", plot = graph, 
       dpi = dpi_num, width = width_num, height = height_num)     

20.1.4 Robustness check (YOY)

graph_yoy_total_bind <- graph_yoy_total_bind + 
  labs(title = "(a) Total") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_total_bind_covar <- graph_yoy_total_bind_covar + 
  labs(title = "(b) Total, with covaraites") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_female_bind <- graph_yoy_female_bind + 
  labs(title = "(c) Female")+ 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_female_bind_covar <- graph_yoy_female_bind_covar + 
  labs(title = "(d) Female, with covaraites") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_male_bind <- graph_yoy_male_bind + 
  labs(title = "(e) Male")+ 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_male_bind_covar <- graph_yoy_male_bind_covar + 
  labs(title = "(f) Male, with covaraites") + 
    scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph <- (graph_yoy_total_bind | graph_yoy_total_bind_covar) / 
  (graph_yoy_female_bind| graph_yoy_female_bind_covar) / 
  (graph_yoy_male_bind| graph_yoy_male_bind_covar) /
  legend_model_types +
  plot_layout(heights = c(2, 2, 2, 0.5))

graph

#保存

ggsave(file = "output/graph_unemploy_diff2_on_yoy_suicide_robust.pdf", plot = graph, 
       dpi = dpi_num, width = width_num, height = height_num)     

21 Regression table/回帰結果表 without covar

options("modelsummary_format_numeric_latex" = "plain")

# 列の選択 column order

# 男女合計、女性、男性、YOYのみ, monthlyhのみ

rows_MONTH <- tribble(~name, ~"(1)", ~"(2)", ~"(3)", ~"(4)", ~"(5)", ~"(6)", 
"Ref. month", "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}",  "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}","\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}")

## results list
table_results_MONTH <- list()
table_results_MONTH[["(1)"]] <- results_total_WLS_trend
table_results_MONTH[["(2)"]] <- results_total_WLS_trend_onlypost
table_results_MONTH[["(3)"]] <- results_female_WLS_trend
table_results_MONTH[["(4)"]] <- results_female_WLS_trend_onlypost
table_results_MONTH[["(5)"]] <- results_male_WLS_trend
table_results_MONTH[["(6)"]] <- results_male_WLS_trend_onlypost

## HTML table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      title_words = "Suicide",
                      gof = gm,
                      output_style = "html") %>%
    kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2))
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
Suicide
Total
Female
Male
Feb. 2020 0.110 −0.007 0.101 0.022 0.117 −0.038
(0.104) (0.074) (0.132) (0.097) (0.146) (0.123)
Mar. 2020 0.066 −0.051 0.008 −0.068 0.123 −0.037
(0.131) (0.086) (0.125) (0.086) (0.201) (0.165)
Apr. 2020 0.134 0.016 0.064 −0.011 0.207 0.043
(0.142) (0.078) (0.135) (0.089) (0.190) (0.118)
May. 2020 0.278 0.158 0.192 0.119 0.366 0.198
(0.109) (0.104) (0.115) (0.093) (0.175) (0.176)
Jun. 2020 0.366 0.245 0.096 0.025 0.646 0.474
(0.136) (0.074) (0.128) (0.063) (0.201) (0.134)
Jul. 2020 0.430 0.308 0.286 0.217 0.573 0.396
(0.123) (0.063) (0.194) (0.124) (0.172) (0.152)
Aug. 2020 0.179 0.056 0.089 0.022 0.270 0.090
(0.158) (0.119) (0.134) (0.089) (0.234) (0.193)
Sep. 2020 0.121 −0.003 0.032 −0.033 0.210 0.024
(0.150) (0.091) (0.121) (0.079) (0.232) (0.155)
Sample size 1551 1551 1551 1551 1551 1551
R2 Adj. 0.379 0.379 0.175 0.176 0.373 0.376
Ref. month {Jan.2020} {\(\leq\)Jan.2020} {Jan.2020} {\(\leq\)Jan.2020} {Jan.2020} {\(\leq\)Jan.2020}
## Latex table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      gof = gm,
                      title_words = "Estimation results for suicide rates, without covariates", 
                      output_style = "latex") %>% 
  kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2)) %>%
  kableExtra::add_footnote(c("Notes: Columns (1), (3), and (5) present baseline WLS estimates shown in  the left-hand side of Figure \\ref{fig:DID_unemploy_on_suicide}. Columns (2), (4), and (6) present WLS estimates based on the model \\eqref{eq:did_model_ver2}, weighted by prefecture population size. The treatment variable is the COVID-19-induced employment shock, which is calculated as equation \\eqref{eq:employment_shock}. Robust standard errors are clustered at the prefecture level."),threeparttable = TRUE, notation = "none",escape = FALSE) %>% 
  kableExtra::column_spec(2:7, width = "1.5cm") %>% 
  kableExtra::save_kable("output/table_unemploy_diff2_on_suicide_robust.tex")
## 2 coefficients  not defined because the design matrix is rank deficient
## 
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient

22 Regression table/回帰結果表 with covar

# 列の選択 column order

# 男女合計、女性、男性、YOYのみ, monthlyhのみ

rows_MONTH <- tribble(~name, ~"(1)", ~"(2)", ~"(3)", ~"(4)", ~"(5)", ~"(6)", 
"Ref. month", "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}",  "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}","\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}")

## results list
table_results_MONTH <- list()
table_results_MONTH[["(1)"]] <- results_total_WLS_trend_covar
table_results_MONTH[["(2)"]] <- results_total_WLS_trend_covar_onlypost
table_results_MONTH[["(3)"]] <- results_female_WLS_trend_covar
table_results_MONTH[["(4)"]] <- results_female_WLS_trend_covar_onlypost
table_results_MONTH[["(5)"]] <- results_male_WLS_trend_covar
table_results_MONTH[["(6)"]] <- results_male_WLS_trend_covar_onlypost

## HTML table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      title_words = "Suicide",
                      gof = gm,
                      output_style = "html") %>%
    kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2))
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
Suicide
Total
Female
Male
Feb. 2020 −0.178 −0.294 −0.047 −0.126 −0.323 −0.478
(0.137) (0.138) (0.148) (0.142) (0.229) (0.238)
Mar. 2020 0.004 −0.113 −0.027 −0.104 0.029 −0.130
(0.180) (0.162) (0.172) (0.138) (0.292) (0.289)
Apr. 2020 0.103 −0.016 0.036 −0.039 0.172 0.008
(0.144) (0.106) (0.153) (0.140) (0.258) (0.204)
May. 2020 0.198 0.078 0.088 0.015 0.308 0.140
(0.170) (0.165) (0.118) (0.118) (0.311) (0.308)
Jun. 2020 0.201 0.080 0.082 0.011 0.329 0.157
(0.185) (0.140) (0.147) (0.118) (0.330) (0.267)
Jul. 2020 0.522 0.400 0.518 0.449 0.521 0.344
(0.200) (0.148) (0.201) (0.138) (0.296) (0.249)
Aug. 2020 −0.147 −0.270 −0.224 −0.291 −0.068 −0.248
(0.195) (0.165) (0.187) (0.177) (0.363) (0.317)
Sep. 2020 0.066 −0.058 0.088 0.023 0.038 −0.147
(0.214) (0.168) (0.163) (0.131) (0.342) (0.277)
Sample size 1551 1551 1551 1551 1551 1551
R2 Adj. 0.377 0.378 0.182 0.184 0.369 0.371
Ref. month {Jan.2020} {\(\leq\)Jan.2020} {Jan.2020} {\(\leq\)Jan.2020} {Jan.2020} {\(\leq\)Jan.2020}
## Latex table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      gof = gm,
                      title_words = "Estimation results for suicide rates, with covariates", 
                      output_style = "latex") %>% 
  kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2)) %>%
  kableExtra::add_footnote(c("Notes:  Columns (1), (3), and (5) present WLS estimates shown in the right-hand side of Figure \\ref{fig:DID_unemploy_on_suicide}. Columns (2), (4), and (6) present WLS estimates based on the model \\eqref{eq:did_model_ver2}, weighted by prefecture population size, and eight covariates are additionally controlled for. The treatment variable is the COVID-19-induced employment shock, which is calculated as equation \\eqref{eq:employment_shock}. Robust standard errors are clustered at the prefecture level."),threeparttable = TRUE, notation = "none",escape = FALSE) %>% 
  kableExtra::column_spec(2:7, width = "1.5cm") %>% 
  kableExtra::save_kable("output/table_unemploy_diff2_on_suicide_robust_covar.tex")
## 2 coefficients  not defined because the design matrix is rank deficient
## 
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient
## 2 coefficients  not defined because the design matrix is rank deficient
## 1 coefficient  not defined because the design matrix is rank deficient